﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using DAO;


namespace DAO
{
    public class KetQuaDAO
    {
        public static bool NhapBangDiemMonHoc( string maMonHoc, string maHocSinh, float diemMuoiLamPhut, float diemMotTiet, float diemGiuaKy, float diemCuoiKy, string hocKy )
        { 

            try{


                //
                //
                String command = "select * from KetQuaMonHoc as tkmh"
                                + " where tkmh.maHocSinh = '" + maHocSinh +"' and tkmh.hocKy = '" + hocKy + "' and tkmh.maMonHoc = '" + maMonHoc + "'";

                DataTable tb =  DaTaProvider.excecuteQuery( command );

                if (tb.Rows.Count != 0)
                    return false;

                command  = "insert into KetQuaMonHoc( maMonHoc, maHocSinh, diemMuoiLamPhut, diemMotTiet, giuaKy, cuoiKy, hocKy ) values ( '"
                 + maMonHoc + "','" + maHocSinh + "'," + diemMuoiLamPhut.ToString() + "," + diemMotTiet.ToString() + "," + diemGiuaKy.ToString() + "," + diemCuoiKy.ToString() + ",'" + hocKy + "'" + ")";

                 DaTaProvider.ExcecuteNonQuery( command );

               }
            catch( Exception ex )
            {
                return false;
            }
            return true;
        }

       

    }
}
